package a_star

import "errors"


type tNodeWeightComparator struct {
}

func newNodeWeightComparator() IComparator {
	return &tNodeWeightComparator{
	}
}

func (me *tNodeWeightComparator) Less(a interface{}, b interface{}) bool {
	if a == nil || b == nil {
		panic(gNullArgumentError)
	}

	n1 := a.(INode)
	n2 := b.(INode)
	return n1.GetTotalWeight() <= n2.GetTotalWeight()
}

var gNullArgumentError = errors.New("null argument error")